package com.byq.ai.agentlab.repository;

import com.byq.ai.agentlab.entity.Task;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface TaskRepository extends JpaRepository<Task, Long> {
    
    @Query(value = "SELECT * FROM task ORDER BY embedding <-> :queryVector LIMIT :limit", nativeQuery = true)
    List<Task> findSimilarTasks(@Param("queryVector") float[] queryVector, @Param("limit") int limit);
} 